<template>
  <div>
    <a-modal v-model="visible" centered width="440px"  title="批量恢复车控" @ok="handleOk" @cancel="close">
      <div style="font-size: 16px;color:#333333">
        车辆数量：{{ arr.length }}
      </div>
      <p>确定要恢复车辆的控制权吗？</p>
    </a-modal>
  </div>
</template>
<script>
import { resumeDevice } from '@/services/car'
export default {
  data () {
    return {
      visible: false,
      arr: []
    }
  },
  methods: {
    open (record) {
      this.arr = record.arr
      this.visible = true
    },
    async handleOk () {
      const res = await resumeDevice({ vehicleIds: this.arr })
      if (res.isSuccess) {
        this.$message.newFun('操作成功！', 'success', 3)
        this.close()
      } else {
        this.$message.newFun(res.msg, 'error', 3)
      }
    },
    close () {
      this.visible = false
      this.$emit('close')
    }
  }
}
</script>
